Skip to content

fix(core): route user:profile email and displayname through IUser - #67633

Open
nursoda wants to merge 2 commits into
nextcloud:masterfrom
nursoda:fix/61831-user-profile-email-displayname
Open

nursoda wants to merge 2 commits into
nextcloud:masterfrom
nursoda:fix/61831-user-profile-email-displayname

Conversation

@nursoda

@nursoda nursoda commented Dec 3, 2026

Copy link
Copy Markdown

Summary

occ user:profile <uid> email|displayname only changed the account property. The system email (IUser::getEMailAddress()) and the backend display name kept their old values, and no UserChangedEvent fired – so mails still went to a deleted address and listeners never noticed.

Both keys now go through the IUser setters, as occ user:setting already does, and the account property is written as well. That also repairs accounts that already drifted.

Behavior changes:

  • Email is validated and normalized (trimmed, lower-cased); invalid addresses are rejected.
  • Display names are trimmed; on a backend that can't change them (e.g. LDAP) the command now fails instead of only changing the profile property. Setting the current value again still succeeds.
  • Reading, --update-only and --error-if-not-exists use the system values for these two keys.
  • If the account update is rejected (e.g. another stored property is invalid), the command reports the reason instead of crashing.

Tested on a local sqlite instance: set, delete, invalid input and listing now behave consistently.

TODO

  • none

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Issue analyzed and fix engineered by @nursoda using Claude Code, reviewed with /simplify and /code-review (Opus 5.5: 1× low, 3× high)

nursoda and others added 2 commits December 3, 2026 15:53
occ user:profile only wrote the account property, so the system email address (IUser::getEMailAddress()) and the user backend's display name kept their old values and no UserChangedEvent was fired. Mails kept going to a deleted address and apps listening for the change never noticed. Setting both keys through the IUser setters, as user:setting does, lets the existing listener sync the account.

Fixes nextcloud#61831

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Olav Seyfarth <olav@seyfarth.de>
…layname

If IUser already held the requested value, no UserChangedEvent fired and a drifted account property stayed wrong while the command reported success - the very state nextcloud#61831 leaves behind. Invalid addresses reached the system email that mails are sent to, display names were compared untrimmed, a rejected account update crashed the command, and reads, --update-only and --error-if-not-exists still looked at the account property instead of the value the command now writes.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Olav Seyfarth <olav@seyfarth.de>
@nursoda
nursoda requested a review from a team as a code owner December 3, 2026 14:55
@nursoda
nursoda requested review from provokateurin and salmart-dev and removed request for a team December 3, 2026 14:55
@nursoda

nursoda commented Dec 3, 2026

Copy link
Copy Markdown
Author

Note: not quite a first-timer fix after all – it changes behavior (email validation and normalization, display name on read-only backends), has to repair accounts that already drifted, and relies on the OC\Accounts\Hooks listener to sync the account. Several review rounds turned up further edge cases.

Assisted by ClaudeCode:claude-opus-5-5

@nursoda

nursoda commented Dec 3, 2026

Copy link
Copy Markdown
Author

/backport to stable34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: occ user:profile <uid> email updates only the account property, leaving the system email address (IUser::getEMailAddress) unchanged

1 participant